local Lua__zhuanghuo = fk.CreateSkill {
  name = "Lua__zhuanghuo",
  tags = { Skill.Compulsory, },
}

Fk:loadTranslationTable {
  ["Lua__zhuanghuo"] = "装货",
  [":Lua__zhuanghuo"] = "锁定技，每名角色出牌阶段结束时，其将一张手牌置于你的武将牌上，称为“货”。若你有“货”，其他角色响应你使用的牌时需要弃置一张牌。",
  ["#zhuanghuo-give"] = "装货：请将一张手牌置为“货”",
  ["#zhuanghuo-discard"] = "装货：请弃置一张牌以响应此牌",
  ["$huo"] = "货",
}

Lua__zhuanghuo:addEffect(fk.EventPhaseEnd, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(Lua__zhuanghuo.name) and target.phase == Player.Play and not target:isKongcheng()
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    -- 选择一张手牌置为“货”
    local cards = room:askToCards(target, {
      min_num = 1,
      max_num = 1,
      pattern = ".",
      prompt = "#zhuanghuo-give",
      skill_name = Lua__zhuanghuo.name,
      cancelable = false,
    })
    if #cards > 0 then
      player:addToPile("$huo", cards, true, Lua__zhuanghuo.name)
    end
  end,
})

local spec = {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(Lua__zhuanghuo.name) and data.responseToEvent and data.responseToEvent.from == player and target ~= player
    and #player:getPile("$huo") > 0 and not target:isKongcheng()
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:askToDiscard(target, {
      min_num = 1,
      max_num = 1,
      cancelable = false,
      include_equip = true,
      prompt = "#zhuanghuo-discard",
      skill_name = Lua__zhuanghuo.name,
    })
  end,
}

Lua__zhuanghuo:addEffect(fk.CardUsing, spec)
Lua__zhuanghuo:addEffect(fk.CardResponding, spec)


return Lua__zhuanghuo
